package com.dailywork.basepro.compro;

import com.dailywork.basepro.lambda.Person;
import freemarker.template.utility.NumberUtil;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ObejctOper {
    public static void main(String[] args) {
        final Person person = new Person();
        System.out.println(person);
        updatePer(person);
        System.out.println(person);
        collectionOper();
//        forEachTest();
        forEachTest2();
    }

    private static void updatePer(Person person) {
        person = new Person();
        System.out.println(person);
    }

    private static void collectionOper() {
        List<String> list = Arrays.asList("1", "2", "3");
        List<Object> list1 = new ArrayList<>();
//        list1 = list;

        List<?> list2 = new ArrayList<>();
        list2 = list;

        List list3 = new ArrayList();
        list3 = list;
    }

    private static void forEachTest() {
        int end = Integer.MAX_VALUE;
        int start = end - 50;
        int count = 0;
        // 这里考察的是数据类型的最值范围
        for (int i = start; i <= end; i++) {
            if (NumberUtil.isNaN(i)) {
                break;
            }
            count++;
            System.out.println("Cur for Each count is: " + count);
        }
    }

    private static void forEachTest2() {
        int count = 0;
        for (byte i = -128; i < 128; i++) {
            count++;
            System.out.println("Cur Count is: " + count);
        }
    }
}
